from aiogram_dialog import DialogManager

from poker_bot.database.services import DiscountService


async def discounts_getter(
    dialog_manager: DialogManager, discount_service: DiscountService, **kwargs
):
    discounts = await discount_service.get_discounts()

    return {"discounts": discounts}


async def discount_info_getter(
    dialog_manager: DialogManager, discount_service: DiscountService, **kwargs
):
    discount_id: int = dialog_manager.dialog_data.get("discount_id")

    discount = await discount_service.get_discount_by_id(discount_id)

    return {
        "discount_title": discount.title,
        "discount_text": discount.text,
    }
